Skip to content

feat: support building on FreeBSD#86

Merged
mattkjames7 merged 10 commits into
masterfrom
feat/freebsd-support
Jul 22, 2026
Merged

feat: support building on FreeBSD#86
mattkjames7 merged 10 commits into
masterfrom
feat/freebsd-support

Conversation

@Ignition

Copy link
Copy Markdown
Contributor

Accept FreeBSD in the CMake OS check and reuse the existing POSIX socket path (src/linux/). Two source portability fixes make that path compile on FreeBSD:

  • endian: FreeBSD provides the byte-order helpers via <sys/endian.h>
    rather than glibc's <endian.h>.
  • SOL_TCP: use the portable POSIX IPPROTO_TCP for TCP-level setsockopt options; SOL_TCP is a Linux-only alias (equal to IPPROTO_TCP there).

Also rename the MGCLIENT_ON_LINUX macro/CMake variable to MGCLIENT_ON_POSIX, since Linux and FreeBSD now share that build path.

Verified: static and shared libraries build with clang on FreeBSD 14.

@Ignition Ignition self-assigned this Jul 14, 2026
@Ignition
Ignition requested review from gitbuda and mattkjames7 July 14, 2026 21:30
@Ignition Ignition added the Docs - changelog only Docs - changelog only label Jul 14, 2026
Comment thread src/linux/mgcommon.h Outdated
Comment thread CMakeLists.txt Outdated
Ignition and others added 10 commits July 22, 2026 10:23
Accept FreeBSD in the CMake OS check and reuse the existing POSIX socket
path (src/linux/). Two source portability fixes make that path compile
on FreeBSD:

- endian: FreeBSD provides the byte-order helpers via <sys/endian.h>
  rather than glibc's <endian.h>.
- SOL_TCP: use the portable POSIX IPPROTO_TCP for TCP-level setsockopt
  options; SOL_TCP is a Linux-only alias (equal to IPPROTO_TCP there).

Also rename the MGCLIENT_ON_LINUX macro/CMake variable to
MGCLIENT_ON_POSIX, since Linux and FreeBSD now share that build path.

Verified: static and shared libraries build with clang on FreeBSD 14.
@Ignition
Ignition force-pushed the feat/freebsd-support branch from df83059 to 09eb776 Compare July 22, 2026 09:23
@mattkjames7
mattkjames7 merged commit fcd56b5 into master Jul 22, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs - changelog only Docs - changelog only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants